﻿using System.Reflection;
using Abp.AutoMapper;
using Abp.Modules;
using KDS.Mes.Mes.Workshops.Mappers;
using KDS.Mes.Mes.Lines.Mappers;
using KDS.Mes.Mes.Stations.Mappers;
using KDS.Mes.Mes.Cartypes.Mappers;
using KDS.Mes.Mes.Alcs.Mappers;
using KDS.Mes.Mes.Styles.Mappers;
using KDS.Mes.Mes.AlcCodes.Mappers;
using KDS.Mes.Authorization;
using KDS.Mes.Mes.Parts.Mappers;
using KDS.Mes.Mes.SeatInfos.Mappers;
using KDS.Mes.Mes.Plans.Mappers;
using KDS.Mes.Mes.PlanDetails.Mappers;
using KDS.Mes.Mes.Onlines.Mappers;
using KDS.Mes.Mes.SeqJits.Mappers;
using KDS.Mes.Mes.JitAlcCodes.Mappers;

namespace KDS.Mes
{
    [DependsOn(typeof(MesCoreModule), typeof(AbpAutoMapperModule))]
    public class MesApplicationModule : AbpModule
    {
        public override void PreInitialize()
        {
            //Configuration.Authorization.Providers.Add<AppAuthorizationProvider>();
            //Configuration.Authorization.Providers.Add<FactoryAppAuthorizationProvider>();
            //Configuration.Authorization.Providers.Add<MesAuthorizationProvider>();
            Configuration.Modules.AbpAutoMapper().Configurators.Add(mapper =>
            {
                CustomDtoMapper.CreateMappings(mapper);
                WorkshopDtoMapper.CreateMappings(mapper);
                LineDtoMapper.CreateMappings(mapper);
                StationDtoMapper.CreateMappings(mapper);
                CartypeDtoMapper.CreateMappings(mapper);
                AlcDtoMapper.CreateMappings(mapper);
                StyleDtoMapper.CreateMappings(mapper);
                AlcCodeDtoMapper.CreateMappings(mapper);
                PartDtoMapper.CreateMappings(mapper);
                SeatInfoDtoMapper.CreateMappings(mapper);
                PlanDtoMapper.CreateMappings(mapper);
                PlanDetailDtoMapper.CreateMappings(mapper);
                OnlineDtoMapper.CreateMappings(mapper);
                SeqJitDtoMapper.CreateMappings(mapper);
                JitAlcCodeDtoMapper.CreateMappings(mapper);

                //Add your custom AutoMapper mappings here...
                //mapper.CreateMap<,>()
            });
        }

        public override void Initialize()
        {
            IocManager.RegisterAssemblyByConvention(Assembly.GetExecutingAssembly());
        }
    }
}
